# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Games.V1.Model.StatsResponse do
  @moduledoc """
  A third party stats resource.

  ## Attributes

  *   `avg_session_length_minutes` (*type:* `number()`, *default:* `nil`) - Average session length in minutes of the player. E.g., 1, 30, 60, ... . Not populated if there is not enough information.
  *   `churn_probability` (*type:* `number()`, *default:* `nil`) - The probability of the player not returning to play the game in the next day. E.g., 0, 0.1, 0.5, ..., 1.0. Not populated if there is not enough information.
  *   `days_since_last_played` (*type:* `integer()`, *default:* `nil`) - Number of days since the player last played this game. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
  *   `high_spender_probability` (*type:* `number()`, *default:* `nil`) - The probability of the player going to spend beyond a threshold amount of money. E.g., 0, 0.25, 0.50, 0.75. Not populated if there is not enough information.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Uniquely identifies the type of this resource. Value is always the fixed string `games#statsResponse`.
  *   `num_purchases` (*type:* `integer()`, *default:* `nil`) - Number of in-app purchases made by the player in this game. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
  *   `num_sessions` (*type:* `integer()`, *default:* `nil`) - The approximate number of sessions of the player within the last 28 days, where a session begins when the player is connected to Play Games Services and ends when they are disconnected. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
  *   `num_sessions_percentile` (*type:* `number()`, *default:* `nil`) - The approximation of the sessions percentile of the player within the last 30 days, where a session begins when the player is connected to Play Games Services and ends when they are disconnected. E.g., 0, 0.25, 0.5, 0.75. Not populated if there is not enough information.
  *   `spend_percentile` (*type:* `number()`, *default:* `nil`) - The approximate spend percentile of the player in this game. E.g., 0, 0.25, 0.5, 0.75. Not populated if there is not enough information.
  *   `spend_probability` (*type:* `number()`, *default:* `nil`) - The probability of the player going to spend the game in the next seven days. E.g., 0, 0.25, 0.50, 0.75. Not populated if there is not enough information.
  *   `total_spend_next_28_days` (*type:* `number()`, *default:* `nil`) - The predicted amount of money that the player going to spend in the next 28 days. E.g., 1, 30, 60, ... . Not populated if there is not enough information.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :avg_session_length_minutes => number() | nil,
          :churn_probability => number() | nil,
          :days_since_last_played => integer() | nil,
          :high_spender_probability => number() | nil,
          :kind => String.t() | nil,
          :num_purchases => integer() | nil,
          :num_sessions => integer() | nil,
          :num_sessions_percentile => number() | nil,
          :spend_percentile => number() | nil,
          :spend_probability => number() | nil,
          :total_spend_next_28_days => number() | nil
        }

  field(:avg_session_length_minutes)
  field(:churn_probability)
  field(:days_since_last_played)
  field(:high_spender_probability)
  field(:kind)
  field(:num_purchases)
  field(:num_sessions)
  field(:num_sessions_percentile)
  field(:spend_percentile)
  field(:spend_probability)
  field(:total_spend_next_28_days)
end

defimpl Poison.Decoder, for: GoogleApi.Games.V1.Model.StatsResponse do
  def decode(value, options) do
    GoogleApi.Games.V1.Model.StatsResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Games.V1.Model.StatsResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
